package org.getOffer.offer46;

/**
 * @Author yu
 * @Date 2021/10/23
 */
public class Solution {

    public static void main(String[] args) {

        int i = 1024;
        Solution solution = new Solution();

        System.out.println(solution.translateNum(i));

    }

    public int translateNum(int num) {

        String str = String.valueOf(num);

        int a = 1, b = 1, c = 1;

        for (int i = 2; i<=str.length(); i++) {

            String sub = str.substring(i-2, i);

            c = sub.compareTo("10") >= 0 && sub.compareTo("25") <= 0 ? a + b : a;

            b = a;

            a = c;

        }

        return c;
    }

}
